import { getUserInfo, setUserInfo, clearUserInfo } from '@/utils/storage'

const state = {
  // 获取用户信息
  userInfo: getUserInfo()
}

const mutations = {
  // 设置用户信息
  setUserInfo (state, obj) {
    state.userInfo = obj
    // 本地存储
    setUserInfo(obj)
  },
  clearUserInfo (state) {
    // 删除用户信息
    clearUserInfo()
  }
}

const actions = {}

const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
